package com.platform.enums;

import com.platform.comm.constants.EnumOption;
import com.platform.comm.enums.IDictEntry;
import com.platform.comm.enums.IEnumOption;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 异议流程状态
 * @author zq
 */
@EnumOption(name = "objectionStatus")
public enum ObjectionStatus implements IDictEntry, IEnumOption<String> {

    /**
     * 待初审
     */
    T0("待初审"),

    /**
     * 初审驳回
     */
    TR("初审驳回"),

    /**
     * 待处理
     */
    T1("待处理"),

    /**
     * 结束
     */
    TF("处理完成");

    private final String description;

    ObjectionStatus(String description) {
        this.description = description;
    }

    public String getDescription() {
        return description;
    }

    @Override
    public String getKey() {
        return name();
    }

    @Override
    public String getValue() {
        return this.description;
    }

    @Override
    public Object getData() {
        return this;
    }

    public static ObjectionStatus parse(String name) {
        try {
            return valueOf(name);
        } catch (Exception e) {
            return null;
        }
    }


    @Override
    public String key() {
        return name();
    }

    @Override
    public String value() {
        return description;
    }

    @Override
    public Map<String, String> enums() {
        return Arrays.stream(values()).collect(Collectors.toMap(IEnumOption::key, IEnumOption::value));
    }
}
